<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="js/jquery.js"></script>
    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"/>
    <link href="css/reg.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="css/base.css" type="text/css"/>
    <link rel="stylesheet" href="css/headbott.css" type="text/css"/>
    <link rel="stylesheet" href="css/index.css" type="text/css"/>
    <link rel="stylesheet" href="css/ly-list.css" type="text/css"/>
    <link rel="stylesheet" href="css/reg.css" type="text/css"/>

    <title></title>
</head>
<body>
<!--上部导航栏开始-->
<div id="header">
    <div class="heade-con">
        <div class="logo"><a href=""><img src="images/LOGO.png"/></a></div>
        <div class="nav posa">
            <ul>
                <li><a class="vcolor" href="index.jsp">首页</a></li>
                <li><a href="gyzc-list.jsp">公益众筹</a></li>
                <li><a href="cop.jsp">常见问题</a></li>
                <li><a href="ly-list.jsp">众筹资讯</a></li>
                <li><a class="vcolor" href="/gotoProjectInfo" style="">发布项目</a></li>
            </ul>
        </div>
        <div class="search">
            <form action="">
                <input type="text" class="search-txt" value="" placeholder="找项目">
                <input type="submit" class="search-but" value="">
            </form>
        </div>
        <c:if test="${user==null}">
            <div class="index-login">
                <a href="/login.jsp">登录</a>
                <span style="color: white;">|</span>
                <a href="/reg.jsp">注册</a>
            </div>
        </c:if>
        <c:if test="${sessionScope.user.uname!=null}">
            <div style="margin-left: 200px" class="index-login">
                <span  style="color: white"><a href="user.jsp"> 欢迎您，${sessionScope.user.uname}</a> |</span>
                <br>

            </div>

        </c:if>
    </div>
</div>
<!--上不导航栏结束-->
<!--中间核心-->
<div class="product">
    <!--头上表格-->
    <div class="product-table">
        <div class="product-left">
            <table class="table table-bordered">
                <tr class="text-center">
                    <%--                    <td class="title-td"><a href="/jbxx">基本信息</a></td>--%>
                    <td class="active title-td"><a>项目信息</a></td>
                    <td class="title-td"><a href="/gotoNewDetail">详细描述</a></td>
                    <td class="title-td"><a href="/gotoNewBack">回报设置</a></td>
                </tr>
            </table>
        </div>
        <div class="product-right">
            <table class="table table-bordered">
                <tr class="text-center">
                    <td class="title-td">预览</td>
                </tr>

            </table>

        </div>
    </div>
    <!--下部foem表单-->
    <div class="product-form">
        <!--上标题-->
        <div class="product-title">
            <div class="my-h4">
                <h4>创建你的项目信息</h4>
            </div>
            <div class="btn-save">
                <button class="btn btn-default"><label for="temp_save">保存草稿</label></button>
            </div>

        </div>
        <div class="clear"></div>
        <hr>
        <!--表单-->
        <form action="/tempProjectInfo" method="post" enctype="multipart/form-data">
            <div class="my-form">
                <div class="product-info-input">

                    <label for="face">
                        <b>设置封面：</b>
                        <img src=""  title="kk" width="475px" height="250px" id="fm"/>
                    </label>
                    <input type="file" id="face">
                </div>
                <script>
                    $(function () {

                        $("#fm").attr("src","#");

                        var urlpricture="${sessionScope.projectTemp.urlpicture}";

                        if(urlpricture.trim()!=""){
                            $("#face").attr("style","display:none");
                            $("#fm").attr("src","images/static/"+urlpricture+"");
                        }else {
                            $("#fm").attr("style","display:none");
                            $("face").attr("name","file");
                        }



                        $("#face").change(function () {
                            $("#face").attr("name","file");
                            $("#face").attr("style","display:block");
                            $("#fm").attr("style","display:none");
                        })

                    })
                </script>

                <div class="product-info-input"><b>项目标题：</b><input class="text" name="ptitle" <c:if test="${sessionScope.projectTemp!=null}">value="${sessionScope.projectTemp.ptitle}" </c:if> type="text" placeholder="给自己的项目起个漂亮的名字吧 (必填项)"></div>
                <div class="product-info-input"><b>筹款目的：</b><div class="text-area"><textarea rows="2" name="pstory" placeholder="一句话介绍一下你的项目吧 (必填项)"><c:if test="${sessionScope.projectTemp!=null}">${sessionScope.projectTemp.pstory}</c:if></textarea></div></div>

                <%--    <div class="product-info-select">
                        <div class="product-info-text"><b>项目地点：</b></div>
                        <div class="product-info-select1">
                            <select class="info-select1">
                                <option>请选择</option>
                            </select>
                        </div>
                        <div class="product-info-select2">
                            <select class="info-select2">
                                <option>请选择</option>
                            </select>
                        </div>
                    </div>--%>

                <div class="product-info-select">
                    <div class="product-info-text"><b>项目地点：</b></div>
                    <div class="product-info-select1" >
                        <%--onchange="changeCity()"--%>
                        <select id="selProvince" onchange="changeCity()"  class="info-select1" name="province">
                            <option>--选择省份--</option>
                            <%--                            <option>河南省</option>--%>
                        </select>
                    </div>
                    <div class="product-info-select2">
                        <select id="selCity" class="info-select2" name="city">
                            <option>--选择市区--</option>
                            <%--                            <option>郑州市</option>--%>
                        </select>
                    </div>
                </div>

                <script type="text/javascript">
                    //1、页面加载完毕后，在第一个下拉框 显示所有省份
                    //数据应该来自数据库  但是现在没有学数据库  来一个 假数据

                    var cityList=new Array();
                    cityList['北京市']=['朝阳区','东城区','海淀区','丰台区'];
                    cityList['河南省']=['郑州市','信阳市','开封市','南阳市'];
                    cityList['黑龙江省']=['哈尔滨','齐齐哈尔','漠河市','黑河市'];

                    function allProvince(){
                        var province = document.getElementById("selProvince");
                        for(var i in cityList){
                            // alert(i);
                            province.add(new Option(i,i),null);
                        }
                    }

                    function changeCity(){
                        //获取省份  河南省
                        //遍历数组  看谁的第一维的值是河南省
                        //把对应的第二维数据拿出来['郑州市','信阳市','开封市','南阳市']
                        //利用for循环 把值一个一个的放在第二个下拉框

                        var province = document.getElementById("selProvince").value;

                        var city = document.getElementById("selCity");
                        //清空内容
                        city.options.length=0;

                        for(var i in cityList){
                            if(i == province){
                                for(var j in cityList[i]){
                                    city.add(new Option(cityList[i][j],cityList[i][j]),null);
                                }
                            }
                        }

                    }
                    // window.onload=allProvince;
                </script>

                <div class="product-info-input"><b>筹资金额：</b><input class="text" type="text" name="ptarget"  <c:if test="${sessionScope.projectTemp!=null}">value="${sessionScope.projectTemp.ptarget}" </c:if>  placeholder="输入你需要的金额，最少500元">元</div>
                <div class="product-info-input"><b>筹资天数：</b><input class="text" type="text" name="pdays"  <c:if test="${sessionScope.projectTemp!=null}">value="${sessionScope.projectTemp.pdays}" </c:if>  placeholder="">天</div>
                <div class="product-info-input"><b>个性标签：</b><input class="text" type="text" name="plable"  <c:if test="${sessionScope.projectTemp!=null}">value="${sessionScope.projectTemp.plable}" </c:if>  placeholder="如果有多个标签以“-”分隔"></div>


                <div class="product-info-select" style="display: flex" >
                    <div class="product-info-input"><b>项目类型：</b></div>
                    <div class="product-info-select1">
                        <select name="tno" class="info-select1">
                            <c:forEach var="item" items="${sessionScope.projectTypesList}">
                                <option value="${item.tno}">${item.tname}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
            </div>

            <button type="submit" id="temp_save" style="display: none"></button>
        </form>
    </div>
</div>

<script>
    $(function () {
        allProvince();


        var psite="${sessionScope.projectTemp.psite}".toString();
        if(psite.indexOf("省")>0){
            var province=psite.substring(0,psite.indexOf("省")+1).toString();
            // alert(province)
            var city=psite.substring(psite.indexOf("省")+1).toString();
        }else {
            var province=psite.substring(0,psite.indexOf("市")+1).toString();
            // alert(province)
            var city=psite.substring(psite.indexOf("市")+1).toString();
        }



        if(psite!=""){

            var eleProvince=$("option:contains('"+province+"')")
            // eleProvince.html(province);
            // eleProvince.val(province)
            eleProvince.attr("selected","true");
            // eleProvince.trigger("click");

            changeCity();
            $("#selProvince").change(function () {
                changeCity();
            })
            var eleCity=$("option:contains('"+city+"')")
            // eleCity.html(city);
            // eleCity.val(city)
            eleCity.attr("selected","true");
        }

        var tno="${sessionScope.projectTemp.tno}";
        if(tno!=""){
            var eleoption_tno=$("option[value='"+tno+"']");
            // alert(eleoption_tno.val())
            eleoption_tno.attr("selected","true");

        }

    })
</script>

<!--底部开始-->
<div id="bottom">
    <div class="bottom-ggt"><a href=""><img src="images/bottbom_68.jpg" alt=""/></a></div>
    <div class="zc-yqlink">
        <ul>
            <li><a href="">阿里巴巴集团</a></li>
            <li><a href="">淘宝网</a></li>
            <li><a href="">天猫</a></li>
            <li><a href="">聚划算</a></li>
            <li><a href="">全球速卖通</a></li>
            <li><a href="">阿里巴巴国际交易市场</a></li>
            <li><a href="">1688</a></li>
            <li><a href="">阿里妈妈</a></li>
            <li><a href="">阿里旅行</a></li>
            <li><a href="">阿里云计算</a></li>
            <li><a href="">阿里巴巴集团</a></li>
            <li><a href="">淘宝网</a></li>
            <li><a href="">天猫</a></li>
            <li><a href="">聚划算</a></li>
            <li><a href="">全球速卖通</a></li>
            <li><a href="">阿里巴巴国际交易市场</a></li>
            <li><a href="">1688</a></li>
            <li><a href="">阿里妈妈</a></li>
            <li><a href="">阿里云计算</a></li>
        </ul>
    </div>
    <div class="footer-bd">

        <a href=" ">关于淘宝</a>
        <a href=" ">合作伙伴</a>
        <a href=" ">营销中心</a>
        <a href=" ">廉正举报</a>
        <a href=" ">联系客服</a>
        <a href=" ">开放平台</a>
        <a href=" ">诚征英才</a>
        <a href=" ">联系我们</a>
        <a href=" ">网站地图</a>
        <a href=" ">法律声明</a>　　　
        <em>© 2003-2015 Taobao.com 版权所有</em><br>

        <br>
        <span>网络文化经营许可证：<a href=" ">浙网文[2013]0268-027号</a></span>
        <b>|</b>
        <span data-spm-protocol="i">增值电信业务经营许可证：<a href="">浙B2-20080224-1</a></span>
        <b>|</b>
        <span>信息网络传播视听节目许可证：1109364号</span>
        <b>|</b>
        <span>举报电话:0571-81683755</span>
    </div>
</div>
</body>
</html>